package com.puppet.building.mapper;

import com.puppet.building.pojo.Building;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BuildingMapper {

    List<Building> getAllBuildings(String search);

    @Insert("insert into building_info values(default,#{buildingName},#{location},#{remark}) ")
    Integer addNewBuilding( Building building);

    @Delete("delete from building_info where building_id=#{buildingId}")
    Integer deleteBuilding(Integer buildingId);

    Integer deleteBuildings(@Param("ids") List<Integer> ids);

    @Select("select * from building_info where building_id=#{buildingId}")
    Building getBuildingById(Integer buildingId);

    @Update("update building_info set building_name=#{buildingName},location=#{location},remark=#{remark} where building_id=#{buildingId}" )
    Integer updateBuilding(Building building);


}
